package com.sample.transaction.atomikos.combine.controller;

import com.sample.transaction.atomikos.combine.service.CombineService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/combine")
@RequiredArgsConstructor
public class CombineController {

    private final CombineService combineService;

    // http://localhost:8081/combine/test?step1=true&step2=true&throwEx=false
    @GetMapping("test")
    public Boolean test(@RequestParam(required = false) Boolean step1,
                        @RequestParam(required = false) Boolean step2,
                        @RequestParam(required = false) Boolean throwEx){
        combineService.testStep(step1, step2, throwEx);
        return Boolean.TRUE;
    }

}
